<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>正则表达式中的区间匹配</title>
</head>
<body>
    <input type="text" name="username" id="">
    <script>
        let hd = 'fjksdgfk87978';
        // [a-z] 26个字母
        console.log(hd.match(/[a-z]/g));
        // [0-9] 10个数字
        console.log(hd.match(/[0-9]/g));

        let input = document.querySelector('[name="username"]');
        input.addEventListener('keyup',function(){
            console.log(this.value.match(/^[a-z]\w{4,7}$/i));
        })
    </script>
</body>
</html>